<?php
class EventoStudenteController extends AppController {
    // var $helpers = array ('Html','Form');
    //errore:var $name = 'Pages'; // riferimento alla cartella delle view
    
    public function beforeFilter(){
    	
		parent::beforeFilter();
        $this->Auth->allow('index','view','add');
    }
    
    public function index() {
    }
	
    public function add($data,$classe,$disciplina,$idRegistro){
            
        $this->loadModel('Studente');    
        $this->Evento->create();
        $this->Evento->set('data',$data);
        $this->Evento->set('registro_id',$idRegistro);
        if($this->Evento->savefirst($this->Studente->find('all',array('conditions'=>array('classe_id'=>$classe)))))
            $this->redirect(array('controller'=>'registro','action'=>'view',$data,$classe,$disciplina));
        else {
            $this->Session->setFlash(__('errore nel salvataggio dell\'evento'),LOG_ERR);
            $this->redirect(array('controller'=>'registro','action'=>'index'));

        }
    }
	
	
		

}
?>